import { fliterPermission } from '@/utils/sys.js'

export const apis = {
  list: `business/basis/getList?modelCode=MODEL_BANNER&authCode=FUNCTION_BANNER`,
  del: `business/banner/del?authCode=BTN_BANNER_DEL`,
  add: `business/banner/add?authCode=BTN_BANNER_ADD`,
  edit: `business/banner/edit?authCode=BTN_BANNER_EDIT`,
  detail: `business/basis/detail?modelCode=MODEL_BANNER&authCode=BTN_BANNER_DETAIL`,
};
export const configs = {
  listUrl: apis.list,
  pageOn: true, // 开启分页
  searchOn: true, // 开启搜索
  operateOn: true, //开启操作区域
  treeOn: false, // 开启树形
};
export const positionOptions = [{
  label:'首页',
  value:'1'
},{
  label:'计费查询',
  value:'2'
},{
  label:'包裹查询',
  value:'3'
}]
export const searchs = [
  {
    type: "Select",
    column: "banner_position",
    label: "所属菜单",
    options: positionOptions,
  },
];

export const pages = {
  pageSize: 20,
  orders: [
    {
      field: "sort",
      sort: "desc",
    },
  ],
};
export const columns = [
  { type: "selection" },
  // { label: "ID", column: "id", sortable: "custom", display: "text" },
  {
    label: "轮播图",
    column: "banner_image",
    slot:'bannerImage',
    width: '240'
  },
  {
    label: "所属菜单",
    column: "banner_position",
    slot:'bannerPosition',
  },
  {
    label: "类型",
    column: "banner_type",
    display: "state",
    format:'dim'
  },
  {
    label: "小程序跳转地址",
    column: "banner_page",

    
  },
  {
    label: "排序",
    column: "sort"
  },
  {
    label: "创建时间",
    column: "ctime",
    format: "datetime",
    display: "text",
    
  },
 
  {
    label: "操作",
    column: "operate",
    width: "220",
    fixed: "right",
  }
];

export const buttons = fliterPermission([
  {
    operate: "add",
    text: "新增",
    permission: 'BTN_BANNER_ADD',
 
  }
  
])
export const columnButtons = fliterPermission([
 
  {
    operate: "edit",
    text: "编辑",
    permission: 'BTN_BANNER_EDIT',

  },
  {
    operate: "delete",
    text: "删除",
    permission: 'BTN_BANNER_DEL',
    type:'danger'
  } 
])
